package br.com.upis.sispat.dao;

import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projection;

import br.com.upis.sispat.exception.PersistentException;

public interface Dao<T> extends Serializable {

	public void create(T object) throws SQLException;
	public void update(T object) throws SQLException;
	public void delete(T object) throws SQLException;
	public void refresh(T object) throws SQLException;
	public List<T> list(String query, String... parameters);
	public Session getSession();
	public T getSingleObject(String query, String... parameters);
	public T getSingleObject(String query);
	public T getObjectFromId(Class<T> clazz, Serializable id);
	public List<T> listAll(Class<T> clazz);
	public List<T> listByCriteriaDemanda(Integer startPage, Integer maxPage,
			List<Criterion> restricoes, List<Projection> projecoes,
			List<Order> ordenacao, Class<T> modelClass) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException;
	public Integer count(Class<T> modelClass);
	public void saveOrUpdate(T o) throws PersistentException;
}
